<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <script src="js/swiper-4.2.6.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="css/swiper-4.2.6.min.css"/>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/font.js"></script>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/ui.css">
    <title></title>
    <!-- 个人中心-设置-信息完善 -->
    <style>
    </style>
</head>
<body>
<div class="scroll-content2 my-setup-perfect" style="overflow:auto;background: #F5F5F5;">
    <div class="top-public">
        <span class="public-center">信息完善</span>        
        <img src="images/left_icon.png" alt="" class="public-left">
        <div class="public-right" onclick="user_complete()">完成</div>
    </div>
    <div class="info-list">
        <ul>
            <a href="my_setup_perfect_name.html">
                <li>
                    <span class="left">姓名</span>
                    <span id="nickname" class="right"> </span>
                </li>
            </a>
            <a href="#">
                <!--my_setup_perfect_phone.html-->
                <li>
                    <span class="left" style="color: red">手机号</span>
                    <span id="mobile" class="right"  style="color: red"> </span>
                </li>
            </a>
            <a href="my_setup_perfect_company.html">
                <li>
                    <span class="left">单位</span>
                    <span id="company" class="right"></span>
                </li>
            </a>
            <a href="#">
                <!--my_setup_perfect_email.html-->
                <li>
                    <span class="left"  style="color: red">邮箱</span>
                    <span id="email" class="right"  style="color: red"></span>
                </li>
            </a>
            <a href="javascript:;" onclick="botwin()">
                <li>
                    <span class="left">企业规模</span>
                    <span id="scale" class="right people"></span>
                </li>
            </a>
        </ul>
        <div class="list-bot">
            <p>业务需求</p>
            <textarea name="demand" id="demand" cols="46" rows="8">  </textarea>
        </div>
    </div>
    <div class="number-people">
        <ul>
            <li onclick="xzpeople(this)">1000以上</li>
            <li onclick="xzpeople(this)">500-1000</li>
            <li onclick="xzpeople(this)">500以下</li>
        </ul>
        <div class="close" onclick="closewin()">取消</div>
    </div>
    <div class="opacity-gray"></div>
</div>
</body>
<script>
$('.public-left').click(function(){
    // window.history.go(-1);
    window.location.href = 'my_setup.html';
});
function botwin(){
    $('.number-people').show();
    $('.opacity-gray').show();
}
function closewin(){
    $('.number-people').hide();
    $('.opacity-gray').hide();
}
function xzpeople(obj){
    var text = $(obj).html();
    $('.people').html(text);
    $('.number-people').hide();
    $('.opacity-gray').hide();
}
</script>

<script>
    $(function(){
        //验证是否登陆
        var user_id = sessionStorage.getItem('userId');
        if (user_id == null) {
            alert('请先登录！');
            window.location.href = 'login.html';
        }
        //用户信息
        user_list();
    });

    //用户信息
    function user_list() {
        var user_id = sessionStorage.getItem("userId"); //用户ID

        $.ajax({
            url: url() + 'api/users/user_details',
            dataType: 'JSON',
            async: true,//请求是否异步，默认为异步，这也是ajax重要特性
            type: "POST",   //请求方式
            data:{
                user_id:user_id,
            },
            success: function (data) {
                //请求成功时处理
                if(data.status==1){
                    sessionStorage.setItem('nickname',data.result.nickname);
                    sessionStorage.setItem('company',data.result.company);
                    $('#nickname').html(data.result.nickname);
                    $('#mobile').html(data.result.mobile);
                    $('#email').html(data.result.email);
                    $('#company').html(data.result.company);
                    $('#scale').html(data.result.scale);
                    $('#demand').html(data.result.demand);
                } else {
                    alert(data.msg);
                }
            }
        })
    }
    
    //用户完善信息
    function user_complete() {
        var user_id = sessionStorage.getItem('userId');
        var scale =  $('.people').html();
        var demand =  $('#demand').val();
        if (scale=='') {
            alert('请您填写企业规模！');
            return false;
        }
        if (demand == '') {
            alert('请您填写业务需求！');
            return false;
        }
        $.ajax({
            url: url() + 'api/users/user_name_company',
            dataType: "JSON",
            async: true, //请求是否异步，默认为异步，这也是ajax重要特性
            type: "POST", //请求方式
            data: {
                user_id:user_id,
                scale:scale,
                demand:demand,
            },
            success: function (data) {
                console.log(data);
                if (data.status == 1) {
                    window.location.href = 'my_setup_perfect.html';
                } else {
                    alert(data.msg);
                }
            }
        });
    }
</script>

</html> 






